package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.bo.InnerObjBo;
import com.ruoyi.system.domain.vo.InnerObjVo;
import com.ruoyi.system.service.ISysTableObjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 最爱喝兽奶
 * @create 2022/7/12
 **/
@Api("获取表内部对象的接口")
@RestController
@RequestMapping("/system/tobj/data")
public class SystemTableObjController {

    @Autowired
    private ISysTableObjService sysTableObjService;


    /**
     * 获取内部对象列表
     */
    @ApiModelProperty("传入查询的sql语句，返回内部对象，sql注入比较危险")
    @GetMapping("/innerObjs")
    private AjaxResult getInnerObjs(InnerObjBo bo) {
        try {
            List<InnerObjVo> innerObjs = sysTableObjService.getInnerObjs(bo);
            return AjaxResult.success(innerObjs);
        } catch (Exception e) {
            return AjaxResult.error();
        }
    }

}
